<template>
<el-dialog title="详情"
           :close-on-click-modal="false" append-to-body
           :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
           width="600px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" >
    <template v-if="!loading">
            <el-col :span="24" >
                <el-form-item  label="供应商编码"   prop="code" >
                        <p>{{dataForm.code}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="供应商名称"   prop="name" >
                        <p>{{dataForm.name}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="是否启用"   prop="enabledmark" >
                        <p>{{dataForm.enabledmark}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="单据状态"   prop="status" >
                         <p>{{ dataForm.status | dynamicText(statusOptions) }} </p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="附件上传"   prop="attachment" >
                    <JNPF-UploadFz    v-model="dataForm.attachment" disabled
 detailed  :showTip="true"  :fileSize="10"  sizeUnit="MB"  :limit="9"  buttonText="点击上传"  >
                </JNPF-UploadFz>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="修改用户"   prop="lastmodifyuserid" >
                        <p>{{dataForm.lastmodifyuserid}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="修改时间"   prop="lastmodifytime" >
                        <p>{{dataForm.lastmodifytime}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="修改原因"   prop="modifyreason" >
                        <p>{{dataForm.modifyreason}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="修改描述"   prop="description" >
                        <p>{{dataForm.description}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="审批时间"   prop="approvetime" >
                        <p>{{jnpf.toDate(dataForm.approvetime,"yyyy-MM-dd HH:mm:ss")}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="24" >
                <el-form-item  label="审批人"   prop="approver" >
                        <p>{{dataForm.approver}}</p>
                </el-form-item>
            </el-col>
    </template>
</el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </span>
    </el-dialog>
</template>
<script>
    import request from '@/utils/request'
    import PrintBrowse from '@/components/PrintBrowse'
    import jnpf from '@/utils/jnpf'
    export default {
        components: {PrintBrowse},
        props: [],
        data() {
            return {
                visible: false,
                loading: false,
                printBrowseVisible: false,
                printId: '',
            dataForm: {
                id :'',
                            code : "",
                            name : '',
                            enabledmark : "372347989370343493",
                            status : "-1",
                            attachment : [],
                            creatoruserid : "",
                            creatortime : "",
                            lastmodifyuserid : "",
                            lastmodifytime : "",
                            modifyreason : '',
                            description : '',
                            approvetime : '',
                            approver : '',
            },
                                statusOptions:[{"fullName":"自由","id":"-1"},{"fullName":"审批通过","id":"1"}],

        }
        },
        computed: {},
        watch: {},
        created() {

        },
        mounted() {},
        methods: {
            dataInfo(dataAll){
                let _dataAll =dataAll
                        _dataAll.status = _dataAll.status ? JSON.parse( _dataAll.status):[]
                        _dataAll.attachment = _dataAll.attachment ? JSON.parse( _dataAll.attachment):[]
                this.dataForm = _dataAll
            },

            init(id) {
                this.dataForm.id = id || 0;
                this.visible = true;
                this.$nextTick(() => {
                    if(this.dataForm.id){
                        this.loading = true
                        request({
                            url: '/api/example/Supplier/detail/'+this.dataForm.id,
                            method: 'get'
                        }).then(res => {
                            this.dataInfo(res.data)
                            this.loading = false
                        })
                    }

                })
            },
        },
    }

</script>
